package com.example.app;

import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

import com.example.app.i.OnCompleteListener;
import com.example.app.observer.MySubjectImpl;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "MainActivity";
    private OnCompleteListener oldListener;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        oldListener = new OnCompleteListener() {
            @Override
            public void onComplete(String result) {
                Log.e(TAG, "onComplete: result = " + result);
            }
        };
        MyAsyncTask myAsyncTask = new MyAsyncTask(oldListener);
        MySubjectImpl.getInstance().notifyObserver(myAsyncTask);
        myAsyncTask.execute();
    }
}
